# coding: UTF-8

#
# This file is a part of the open-eBackup project.
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
# If a copy of the MPL was not distributed with this file, You can obtain one at
# http://mozilla.org/MPL/2.0/.
#
# Copyright (c) [2024] Huawei Technologies Co.,Ltd.
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
#

from pydantic import BaseModel, Field


class RedisNodeExtendInfo(BaseModel):
    ip: str = Field(None, description='绑定ip')
    port: int = Field(None, description='端口号')
    slot: str = Field(None, description='redis节点槽位号')
    role: int = Field(None, description='redis主从角色')


class RedisNodeInfo(RedisNodeExtendInfo):
    uuid: str = Field(None, description='uuid')
    version: str = Field(None, description='redis节点版本')


class Auth(BaseModel):
    auth_type: int = Field(None, description='认证类型')
    auth_key: str = Field(None, description='key')
    auth_pwd: str = Field(None, description='密码')
    extend_info: dict = Field(None, description='扩展字段')


class MasterSlavePair(BaseModel):
    slot: str = Field(default='', description='槽位号')
    rdb_path: str = Field(default='', description='rdb文件名')
    master_id: str = Field(default='', description='主节点ID')
    host: str = Field(default='', description='主机信息')
    nodes: list = Field(default=[], description='该槽位号对应的目标节点')
